Hello. Welcome to
your first activity. In this activity, we
are going to set up Hadoop using Docker containers. Additional to the main
goal of this activity, we are also going
to copy files into and out of the Hadoop
distributed file system. First step, I'm going to
open a terminal shell. In this case, I'm using
Windows Power shell, and I'm going to move to the Hadoop directory that
you downloaded from GitHub. I'm typing CD,
desktop, Coursera, Big Data 1, and Hadoop, where my files are located. I quickly type LS, and these are the files that
are inside of my directory. As our step number 2, we have to make sure that the
Docker engine is running, and to do this, we simply
open Docker desktop. Now that Docker is running, we're going to build our
cluster, and to do this, we're going to type
Docker compose up to call our Docker
compose configuration file. We're going to type minus d, so our containers are not
running in our terminal window. We type enter, and
as we can see, now our cluster is running, and each of the
different components of the cluster are being hosted
by a different container. Before we access the
containers shell, there are a couple of
files that we need to copy inside of the
name not container. To do this, there
are two commands available in the written
instructions for this activity. We're going to take the first
one and copy it right here. We're going to copy
the Madrid side file, which is inside of
our Hadoop directory. And we're going to
copy it inside of this direction in name nut. We type enter, and we can see how the file was
successfully copied. The second file,
it's going to be a file which contains the
works of William Shakespeare, so we copy the second command. As we see, we're copying words, which is right here, and we're also copying
inside of name naught to this directory inside
of the container. We type enter, and we also
successfully copied the file. After doing this, we can now run these command also available in the reading instructions in
which we are going to start a session of the shell inside
of the name not container. Once we are inside name node, the first thing
that we're going to do is that we're going to create the root folder for the Hadoop
distributed file system, so we're going to type
HDFS follow by DFS, the command M DR
to make directory, the flag minus speed to create the necessary
parent directories, and the paths for a root folder, which is user Hadoop. We type enter and usually
when we don't get any error, this means that we successfully
created our directory. After we successfully
created our root folder. We're going to copy some files inside of the
distorted file system. First, we're going to type HDFS, followed by DFS again. The same we're going
to call the LS command to list the files
inside of the folder. As we see, nothing
comes out because there are no files yet
inside of the folder. We are going to put one
file by typing HDFS DFS, and the same we're going to call the copy from local command. To copy the words file that we previously placed
inside of the container. We type enter, and as we see, we get no errors. You're going to verify
that our file was indeed successfully copied into the
distributed file system. To do this, we're
going to simply call again the LS command. And after doing this, we can see the permissions
of the file, the ownership of the file, the date of creation, and
the name of the file. Let's do a different thing now. This time, let's make a copy within the
distributed file system. And to do this, we're
going to type HDFS, DFS. This time we're just going to
type CP, which means copy. We type the name of the
file that we want to copy, and we also type the
name of this new copy, which in this case, we're
just going to call words two. We type Enter, and
we get no errors. We're going to call LS again. As we see, there
are now two files inside of the
distributed file system, which have the exact
same same permissions. Now we're going to
copy a file from the distrit file system
to our local system. To do this, we're going
to start by typing again HDFS followed by DFS. And this time we're
going to copy two local, not from local. We type the name of the
file that we want to copy, which is words two text file. We type enter, and
we get no errors. We simply call LS
to list our files. And as we see, we
have words two right here along with the
original words text file. As a final step, let's remove the copy that we created within the distributed
file system. We start as usual
with H DFS DFS, followed by RM, which
means to remove, followed by the name of the
file that we want to remove. We type enter, and we get this confirmation message
that Words two was deleted. We do a double check by listing the files of the distributed
file system again. As we see, now we
only have one file. This is how we conclude
our first activity.